const net = require('net');

const server = net.createServer((socket) => {
 console.log('Client connected');

 socket.on('data', (data) => {

  console.log(`Received data from client: ${data.toString()}`);
 });

 socket.on('end', () => {
  console.log('Client disconnected');
 });
});

server.listen(3001, () => {
 console.log('Server is listening on port 8080');
});